<?php
	require(__DATAGEN_CLASSES__ . '/TableTransactionGen.class.php');

	/**
	 * The TableTransaction class defined here contains any
	 * customized code for the TableTransaction class in the
	 * Object Relational Model.  It represents the "table_transaction" table 
	 * in the database, and extends from the code generated abstract TableTransactionGen
	 * class, which contains all the basic CRUD-type functionality as well as
	 * basic methods to handle relationships and index-based loading.
	 * 
	 * @package My Application
	 * @subpackage DataObjects
	 * 
	 */
	class TableTransaction extends TableTransactionGen {
		/**
		 * Default "to string" handler
		 * Allows pages to _p()/echo()/print() this object, and to define the default
		 * way this object would be outputted.
		 *
		 * Can also be called directly via $objTableTransaction->__toString().
		 *
		 * @return string a nicely formatted string representation of this object
		 */
		public function __toString() {
			return sprintf('TableTransaction Object %s',  $this->intId);
		}

        public function bool_transaction_of_mine($key_)
        {
            if($this->UserId==$key_)
            {
                return true;
            }
            return false;
        }

        public function bool_cancel_for_the_project($key_)
        {
            if($this->ProjectId==$key_)
            {
                return true;
            }
            return false;
        }

        //type
        public function bool_type_none()
        {
            if($this->Type==0)
            {
                return true;
            }
            return false;
        }

        public function bool_type_money_deposit_by_admin()
        {
            if($this->Type==1)
            {
                return true;
            }
            return false;
        }

        public function bool_type_money_withdraw_by_admin()
        {
            if($this->Type==2)
            {
                return true;
            }
            return false;
        }

        public function bool_type_money_deposit_through_bank()
        {
            if($this->Type==3)
            {
                return true;
            }
            return false;
        }

        public function bool_type_money_withdraw_through_bank()
        {
            if($this->Type==4)
            {
                return true;
            }
            return false;
        }

        public function bool_type_money_deposit_through_paypal()
        {
            if($this->Type==5)
            {
                return true;
            }
            return false;
        }

        public function bool_type_money_withdraw_through_paypal()
        {
            if($this->Type==6)
            {
                return true;
            }
            return false;
        }

        public function bool_type_money_deposit_request_by_admin()
        {
            if($this->Type==7)
            {
                return true;
            }
            return false;
        }

        public function bool_type_money_withdraw_request_by_admin()
        {
            if($this->Type==8)
            {
                return true;
            }
            return false;
        }

        public function bool_type_money_deposit_request_through_bank()
        {
            if($this->Type==9)
            {
                return true;
            }
            return false;
        }

        public function bool_type_money_withdraw_request_through_bank()
        {
            if($this->Type==10)
            {
                return true;
            }
            return false;
        }

        public function bool_type_money_withdraw_request_through_paypal()
        {
            if($this->Type==11)
            {
                return true;
            }
            return false;
        }

        public function bool_type_money_deposit_cancel_by_admin()
        {
            if($this->Type==12)
            {
                return true;
            }
            return false;
        }

        public function bool_type_money_withdraw_cancel_by_admin()
        {
            if($this->Type==13)
            {
                return true;
            }
            return false;
        }

        public function bool_type_money_deposit_cancel_through_bank()
        {
            if($this->Type==14)
            {
                return true;
            }
            return false;
        }

        public function bool_type_money_withdraw_cancel_through_bank()
        {
            if($this->Type==15)
            {
                return true;
            }
            return false;
        }

        public function bool_type_money_withdraw_cancel_through_paypal()
        {
            if($this->Type==16)
            {
                return true;
            }
            return false;
        }

        //escrow
        public function bool_type_escrow_deposit_by_user()
        {
            if($this->Type==17)
            {
                return true;
            }
            return false;
        }

        public function bool_type_escrow_deposit_by_admin()
        {
            if($this->Type==18)
            {
                return true;
            }
            return false;
        }

        public function bool_type_escrow_release_by_user()
        {
            if($this->Type==19)
            {
                return true;
            }
            return false;
        }

        public function bool_type_escrow_release_by_admin()
        {
            if($this->Type==20)
            {
                return true;
            }
            return false;
        }

        public function bool_type_escrow_cancel_by_user()
        {
            if($this->Type==21)
            {
                return true;
            }
            return false;
        }

        public function bool_type_escrow_cancel_by_admin()
        {
            if($this->Type==22)
            {
                return true;
            }
            return false;
        }

        public function bool_type_charge_by_admin()
        {
            if($this->Type==23)
            {
                return true;
            }
            return false;
        }

        public function bool_type_charge_for_bank_deposit()
        {
            if($this->Type==24)
            {
                return true;
            }
            return false;
        }

        public function bool_type_charge_for_bank_withdraw()
        {
            if($this->Type==25)
            {
                return true;
            }
            return false;
        }

        public function bool_type_charge_for_paypal_deposit()
        {
            if($this->Type==26)
            {
                return true;
            }
            return false;
        }

        public function bool_type_charge_for_paypal_withdraw()
        {
            if($this->Type==27)
            {
                return true;
            }
            return false;
        }

        public function bool_type_charge_for_purchase_item()
        {
            if($this->Type==28)
            {
                return true;
            }
            return false;
        }

        public function bool_type_charge_for_subscription()
        {
            if($this->Type==29)
            {
                return true;
            }
            return false;
        }

        public function bool_type_charge_for_review_without_completion()
        {
            if($this->Type==30)
            {
                return true;
            }
            return false;
        }

        public function bool_type_charge_for_review_update_without_completion()
        {
            if($this->Type==31)
            {
                return true;
            }
            return false;
        }

        public function bool_type_charge_for_escrow_transfer()
        {
            if($this->Type==32)
            {
                return true;
            }
            return false;
        }

        public function bool_type_charge_for_posting_project()
        {
            if($this->Type==33)
            {
                return true;
            }
            return false;
        }

        public function bool_type_charge_for_posting_project_options()
        {
            if($this->Type==34)
            {
                return true;
            }
            return false;
        }

        public function bool_type_charge_for_project_won()
        {
            if($this->Type==35)
            {
                return true;
            }
            return false;
        }

        //set type
        public function set_type_none()
        {
            $this->Type=0;
        }

        public function set_type_money_deposit_by_admin()
        {
            $this->Type=1;
        }

        public function set_type_money_withdraw_by_admin()
        {
            $this->Type=2;
        }

        public function set_type_money_deposit_through_bank()
        {
            $this->Type=3;
        }

        public function set_type_money_withdraw_through_bank()
        {
            $this->Type=4;
        }

        public function set_type_money_deposit_through_paypal()
        {
            $this->Type=5;
        }

        public function set_type_money_withdraw_through_paypal()
        {
            $this->Type=6;
        }

        public function set_type_money_deposit_request_by_admin()
        {
            $this->Type=7;
        }

        public function set_type_money_withdraw_request_by_admin()
        {
            $this->Type=8;
        }

        public function set_type_money_deposit_request_through_bank()
        {
            $this->Type=9;
        }

        public function set_type_money_withdraw_request_through_bank()
        {
            $this->Type=10;
        }

        public function set_type_money_withdraw_request_through_paypal()
        {
            $this->Type=11;
        }

        public function set_type_money_deposit_cancel_by_admin()
        {
            $this->Type=12;
        }

        public function set_type_money_withdraw_cancel_by_admin()
        {
            $this->Type=13;
        }

        public function set_type_money_deposit_cancel_through_bank()
        {
            $this->Type=14;
        }

        public function set_type_money_withdraw_cancel_through_bank()
        {
            $this->Type=15;
        }

        public function set_type_money_withdraw_cancel_through_paypal()
        {
            $this->Type=16;
        }

        //escrow
        public function set_type_escrow_deposit_by_user()
        {
            $this->Type=17;
        }

        public function set_type_escrow_deposit_by_admin()
        {
            $this->Type=18;
        }

        public function set_type_escrow_release_by_user()
        {
            $this->Type=19;
        }

        public function set_type_escrow_release_by_admin()
        {
            $this->Type=20;
        }

        public function set_type_escrow_cancel_by_user()
        {
            $this->Type=21;
        }

        public function set_type_escrow_cancel_by_admin()
        {
            $this->Type=22;
        }

        public function set_type_charge_by_admin()
        {
            $this->Type=23;
        }

        public function set_type_charge_for_bank_deposit()
        {
            $this->Type=24;
        }

        public function set_type_charge_for_bank_withdraw()
        {
            $this->Type=25;
        }

        public function set_type_charge_for_paypal_deposit()
        {
            $this->Type=26;
        }

        public function set_type_charge_for_paypal_withdraw()
        {
            $this->Type=27;
        }

        public function set_type_charge_for_purchase_item()
        {
            $this->Type=28;
        }

        public function set_type_charge_for_subscription()
        {
            $this->Type=29;
        }

        public function set_type_charge_for_review_without_completion()
        {
            $this->Type=30;
        }

        public function set_type_charge_for_review_update_without_completion()
        {
            $this->Type=31;
        }

        public function set_type_charge_for_escrow_transfer()
        {
            $this->Type=32;
        }

        public function set_type_charge_for_posting_project()
        {
            $this->Type=33;
        }

        public function set_type_charge_for_posting_project_options()
        {
            $this->Type=34;
        }

        public function set_type_charge_for_project_won()
        {
            $this->Type=35;
        }


        //functions
        public function set_transaction_date_for_now()
        {
            $this->TransactionDate=QDateTime::Now();
        }


		// Override or Create New Load/Count methods
		// (For obvious reasons, these methods are commented out...
		// but feel free to use these as a starting point)
/*
		public static function LoadArrayBySample($strParam1, $intParam2, $objOptionalClauses = null) {
			// This will return an array of TableTransaction objects
			return TableTransaction::QueryArray(
				QQ::AndCondition(
					QQ::Equal(QQN::TableTransaction()->Param1, $strParam1),
					QQ::GreaterThan(QQN::TableTransaction()->Param2, $intParam2)
				),
				$objOptionalClauses
			);
		}

		public static function LoadBySample($strParam1, $intParam2, $objOptionalClauses = null) {
			// This will return a single TableTransaction object
			return TableTransaction::QuerySingle(
				QQ::AndCondition(
					QQ::Equal(QQN::TableTransaction()->Param1, $strParam1),
					QQ::GreaterThan(QQN::TableTransaction()->Param2, $intParam2)
				),
				$objOptionalClauses
			);
		}

		public static function CountBySample($strParam1, $intParam2, $objOptionalClauses = null) {
			// This will return a count of TableTransaction objects
			return TableTransaction::QueryCount(
				QQ::AndCondition(
					QQ::Equal(QQN::TableTransaction()->Param1, $strParam1),
					QQ::Equal(QQN::TableTransaction()->Param2, $intParam2)
				),
				$objOptionalClauses
			);
		}

		public static function LoadArrayBySample($strParam1, $intParam2, $objOptionalClauses) {
			// Performing the load manually (instead of using QCubed Query)

			// Get the Database Object for this Class
			$objDatabase = TableTransaction::GetDatabase();

			// Properly Escape All Input Parameters using Database->SqlVariable()
			$strParam1 = $objDatabase->SqlVariable($strParam1);
			$intParam2 = $objDatabase->SqlVariable($intParam2);

			// Setup the SQL Query
			$strQuery = sprintf('
				SELECT
					`table_transaction`.*
				FROM
					`table_transaction` AS `table_transaction`
				WHERE
					param_1 = %s AND
					param_2 < %s',
				$strParam1, $intParam2);

			// Perform the Query and Instantiate the Result
			$objDbResult = $objDatabase->Query($strQuery);
			return TableTransaction::InstantiateDbResult($objDbResult);
		}
*/




		// Override or Create New Properties and Variables
		// For performance reasons, these variables and __set and __get override methods
		// are commented out.  But if you wish to implement or override any
		// of the data generated properties, please feel free to uncomment them.
/*
		protected $strSomeNewProperty;

		public function __get($strName) {
			switch ($strName) {
				case 'SomeNewProperty': return $this->strSomeNewProperty;

				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

		public function __set($strName, $mixValue) {
			switch ($strName) {
				case 'SomeNewProperty':
					try {
						return ($this->strSomeNewProperty = QType::Cast($mixValue, QType::String));
					} catch (QInvalidCastException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				default:
					try {
						return (parent::__set($strName, $mixValue));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}
*/
	}
?>